package com.kye.express.business.order_list;

import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.kye.express.business.order_list.subfragment.OrderListTakenFragment;
import com.kye.express.business.order_list.subfragment.OrderListToTakeFragment;

/**
 * @author : Joe
 * @version : 1.0
 * @editor : Joe
 * @created : 29/12/2017
 * @updated : 29/12/2017
 * @description : <Description>
 * @update_reason : <UpdateReason>
 */

public class OrderListPageAdapter extends FragmentPagerAdapter {

    public OrderListPageAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        switch (position) {
            case 0: {
                return OrderListToTakeFragment.newInstance();
            }
            case 1: {
                return OrderListTakenFragment.newInstance();
            }
            default:
                throw new IllegalStateException("orderPageType error.");
        }
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return super.getPageTitle(position);
    }

    @Override
    public int getCount() {
        return 2;
    }
}
